Conversation
Mostly scf.if. Stuff towards getting dynamic mxfp4 working. This was the main piece to get a simple example compiling but not passing. Just adopts the loop handling for register liveness, which will not be enough, but was the simplest thing to split this off.
| auto loc = op->getLoc(); | ||
|
|
||
| int32_t mask = 0; | ||
| if (auto maskAttr = op->getAttrOfType<IntegerAttr>("mask")) { |
There was a problem hiding this comment.
Normally I'd expect the function to take an op of a specific type, or at least to cast and use a named accessor.
| ctx.getMapper().mapValue(loadOp.getResult(), loadInstr.getResult(0)); | ||
|
|
||
| Type elemType = memrefType.getElementType(); | ||
| int64_t elemBytes = (elemType.getIntOrFloatBitWidth() + 7) / 8; |
There was a problem hiding this comment.
If this intends to do a ceilDiv, llvm has a function for that.
| for (Region ®ion : regionOp->getRegions()) { | ||
| for (Block &block : region) { | ||
| Operation *terminator = block.getTerminator(); | ||
| if (terminator) { |
There was a problem hiding this comment.
IIRC, getTerminator will assert if the block does not have a terminator so its result should never be null, but may be worth doubl-checking.
| return; | ||
|
|
||
| auto &thenBlock = ifOp.getThenBlock(); | ||
| auto thenYield = dyn_cast<YieldOp>(thenBlock.getTerminator()); |
There was a problem hiding this comment.
cast, the terminator of an if is guaranteed to be a yield.
| elseYield = dyn_cast<YieldOp>(elseBlock->getTerminator()); | ||
| } | ||
|
|
||
| for (unsigned i = 0; i < ifOp->getNumResults(); ++i) { |
There was a problem hiding this comment.
| llvm::SmallVector<Value> members; | ||
| members.push_back(ifResult); | ||
|
|
||
| if (i < thenYield.getResults().size()) { |
There was a problem hiding this comment.
| if (i < thenYield.getResults().size()) { | |
| if (i < thenYield->getNumResults()) { |
| // Test: scf.if translation to waveasm.if, including result type propagation | ||
| // from then-yield operands and else-branch type matching. |
There was a problem hiding this comment.
Where is the type propagation checked?
| @@ -0,0 +1,110 @@ | |||
| // RUN: waveasm-translate --disable-pass-verifier --waveasm-linear-scan %s 2>&1 | FileCheck %s | |||
There was a problem hiding this comment.
Does this and other tests actually need the (non-portable) 2>&1 ?
Mostly scf.if.
Stuff towards getting dynamic mxfp4 working. This was the main piece to get a simple example compiling but not passing. Just adopts the loop handling for register liveness, which will not be enough, but was the simplest thing to split this off.
Not clear how useful this is until I actually get stuff working on top of it, but this passes the basic tests.